// See the Electron documentation for details on how to use preload scripts:
// https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts

// main.js 或 preload.js
const {contextBridge, ipcRenderer} = require('electron')

contextBridge.exposeInMainWorld('appApi', {
    rendererSend: (channel, ...args) => ipcRenderer.send(channel, ...args),
    rendererListen: (channel, f) => ipcRenderer.on(channel, f),
    getAppSetting: (module) => ipcRenderer.invoke('get-app-setting', module),
    setAppSetting: (module, key, value) => ipcRenderer.invoke('set-app-setting', module, key, value),
})

